<link rel="stylesheet" href="<?= str_replace('/index.php', '', $_SERVER['SCRIPT_NAME']) ?>/<?= APPPATH ?>views/admin/css/jquery-ui-1.10.3.css" />
<script src="<?= str_replace('/index.php', '', $_SERVER['SCRIPT_NAME']) ?>/<?= APPPATH ?>views/admin/js/jquery-ui-1.10.3.js"></script>
<script>
    $(function() {
        $("#tabs").tabs();
        $('#maincat').change(function(){
            if($(this).val() == '0'){
                $('#special_orders').show();
                $('.additionaldata').hide();
                
            }else{
                $('#special_orders').hide();
                $('#color').attr('checked', false)
                $('#size').attr('checked', false)
                $('.additionaldata').show();
            }
        })
        
        $('#maincat').change()
    });
</script>
<form class="form-horizontal" action="<?= current_url() ?>" method="post" id="form-validate" >
    <div id="validation" class="row-fluid">
        <div class="span12">
            <div class="box corner-all">
                <div class="box-header grd-white color-silver-dark corner-top">
                    <div class="header-control">
                        <a data-box="collapse"><i class="icofont-caret-up"></i></a>

                    </div>
                    <span><?= lang('label_menu_link_add') . ' ' . lang('label_menu_link_category'); ?></span>
                </div>
                <div class="box-body">

                    <fieldset>

                        <div class="control-group">
                            <label class="control-label" for="maincat"><?= lang('label_main_cat') ?></label>
                            <div class="controls">
                                <select name="maincat" id="maincat">
                                    <option value="0"><?= lang('label_this_main_cat') ?></option>
                                    <?php foreach($maincats as $mcats){ ?>
                                    <option value="<?= $mcats->id ?>"><?php
                                                    $mtitle = unserialize($mcats->title);
                                                    echo (isset($mtitle['ar'])) ? $mtitle['ar'] : $mtitle['en'];
                                                    ?></option>
                                    <?php } ?>
                                </select>
                            </div>
                        </div>
                        
                        <div class="control-group additionaldata">
                            <label class="control-label" for="additional"><?= lang('label_cat_additional') ?></label>
                            <div class="controls">
                                <input class="grd-white" name="additional" id="additional" placeholder="<?= lang('label_cat_additional') ?>" value="<?= (form_val("additional")) ? form_val("additional") : '' ?>" type="text" /><div style="color: red"><?= lang('label_cat_additional_place') ?></div>
                            </div>
                        </div>
                        
                        <div id="special_orders" style="display: none">
                        <div class="control-group">
                                <label class="control-label" for="color"></label>
                                <div class="controls">
                                    <label class="checkbox">
                                        <input type="checkbox" data-form="uniform" name="color" id="color" placeholder="<?= lang('label_need_color') ?>" type="checkbox" ><?= lang('label_need_color') ?>
                                    </label>

                                </div>
                            </div>
                        
                        <div class="control-group">
                                <label class="control-label" for="size"></label>
                                <div class="controls">
                                    <label class="checkbox">
                                        <input type="checkbox" data-form="uniform" name="size" id="size" placeholder="<?= lang('label_need_size') ?>" type="checkbox" ><?= lang('label_need_size') ?>
                                    </label>

                                </div>
                            </div>
                        </div>
                        
                        <div id="tabs">
                            <ul>
                                <?php foreach ($language as $la) { ?>
                                    <li><a href="#<?= $la->code ?>"><img src="<?= str_replace('/index.php', '', $_SERVER['SCRIPT_NAME']) ?>/<?= APPPATH ?>views/admin/images/<?= $la->code ?>.png" alt=""></a>
                                    <?php } ?>
                            </ul>
                            <?php foreach ($language as $la) { ?>
                                <div class="control-group" id="<?= $la->code ?>">
                                    <label class="control-label" for="title_<?= $la->code ?>"><?= lang('label_name') ?></label>
                                    <div class="controls">
                                        <input class="grd-white" name="title[<?= $la->code ?>]" id="title_<?= $la->code ?>" placeholder="<?= lang('label_name') ?>" value="<?= form_val("title=>$la->code") ?>" type="text" />
                                    </div>
                                </div>
                            <?php } ?>
                        </div>
                        <div style="margin: 15px" ></div>
                        
                        

                        <div class="control-group">
                            <label class="control-label" for="code"></label>
                            <div class="controls">
                                <input class="grd-white" name="code" id="code" value="text" type="hidden" />
                            </div>
                        </div>
                        <div class="form-actions">
                            <button type="submit" class="btn btn-primary"><li class="icon-plus" style="margin-left: 5px"></li><?= lang('label_add') ?></button>
                            <button type="button" class="btn">Cancel</button>
                        </div>
                    </fieldset>


                </div>
            </div>
        </div>
    </div>
</form>